Skip to content

fix(nest): fix stream expiry, token refresh, timeouts, and resource leaks#2194

Open
MechanicalCoderX wants to merge 1 commit intoAlexxIT:masterfrom
MechanicalCoderX:fix/nest-bugs
Open

fix(nest): fix stream expiry, token refresh, timeouts, and resource leaks#2194
MechanicalCoderX wants to merge 1 commit intoAlexxIT:masterfrom
MechanicalCoderX:fix/nest-bugs

Conversation

@MechanicalCoderX
Copy link
Copy Markdown

  • ExtendStream: replace one-shot *time.Timer with an extendStop channel loop so streams are extended reliably every ~55 seconds instead of expiring after the first extension fires and is not rescheduled

  • refreshToken: store ClientID/ClientSecret/RefreshToken on the API struct so refreshToken() can re-authenticate directly; the previous cache-key lookup failed after the first token rotation because the cached entry had already been replaced

  • NewAPI/GetDevices/ExchangeSDP: fix HTTP client timeout of 5000 * time.Second to 10 * time.Second

  • rtcConn: call pc.Close() on all three error paths (CreateCompleteOffer, ExchangeSDP, SetAnswer) to prevent WebRTC peer connection leaks

  • Fix typos cliendIDclientID, cliendSecretclientSecret, compataiilitycompatibility

…eaks

- ExtendStream: replace one-shot *time.Timer with an extendMu/extendStop
  channel loop so streams are extended reliably every ~55 seconds instead
  of expiring after the first extension fires and is not rescheduled

- refreshToken: store ClientID, ClientSecret, RefreshToken on the API
  struct so refreshToken() can re-authenticate directly; the previous
  cache-key lookup failed after the first token rotation because the
  cached entry had already been replaced with the new token

- NewAPI/GetDevices/ExchangeSDP: fix HTTP client timeout of 5000 seconds
  (5000 * time.Second) to a sane 10 * time.Second

- rtcConn: call pc.Close() on all three error paths (CreateCompleteOffer,
  ExchangeSDP, SetAnswer) to prevent WebRTC peer connection leaks

- client.go/api.go: fix typos cliendID → clientID, cliendSecret →
  clientSecret throughout; fix "backwards compataiility" comment typo
gavinscheele added a commit to gavinscheele/go2rtc that referenced this pull request Apr 14, 2026
…eaks

Cherry-picked from AlexxIT/go2rtc PR AlexxIT#2194.

- Replace one-shot extend timer with a loop that reschedules after each
  successful extension — stream stays alive indefinitely
- Store OAuth credentials on API struct so refreshToken() works after
  the first token rotation (cache key lookup broke after rotation)
- Fix HTTP timeout from 5000s (typo) to 10s
- Add retry logic on ExtendStream: 401 → refresh token, 409/429 → backoff
- Close WebRTC peer connections on all error paths (prevent resource leaks)
- Fix typos: cliendID → clientID, compataiility → compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant